#!/usr/bin/env python
#-*- coding:utf-8 -*-
'''
__author-default__ = 'Pup--->>WX_l599p22'
__cttime-default__ = '20170721'
'''

#
# import socket
#
# s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
# s.connect('www.sina.com.cn',80)
#
# s.send('GET /1.1\r\nHost: www.sina.com.cn\r\nConnection: close\r\n\r\n')
# buffer = []
# while True:
# 	d = s.recv(1024)
# 	if d:
# 		buffer.append(d)
# 	else:
# 		break
# data = ''.join(buffer)
# s.close()
# header,html = data.split('\r\n\r\n',1)
# print header
# with open(r'../egData/sina.html','wb') as f:
# 	f.write(html)
#

# def qh(a,b):
# 	x = a*b
# 	return x
#
# print

import logging

# 1
# def foo():
# 	print 'i am foo'
# 	logging.info('foo is running')

# 2
# def use_logging(func):
# 	logging.warn('{} is running'.format(func.__name__))
# 	func()
#
# def bar():
# 	print 'i am bar'
#
# use_logging(bar)

def use_logging(func):
	def wrapper(*args,**kwargs):
		logging.warn('{} is running'.format(func.__name__))
		return func(*args,**kwargs)
	return wrapper

def bar():
	print 'i am bar'

bar = use_logging(bar)
bar()